<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Spring 注解完全指南</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        
        .annotation-card {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            transition: all 0.3s ease;
            border: 1px solid rgba(255, 255, 255, 0.18);
        }
        
        .annotation-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
        }
        
        .code-block {
            background: #1e1e1e;
            color: #d4d4d4;
            border-radius: 8px;
            overflow-x: auto;
            position: relative;
        }
        
        .code-block pre {
            margin: 0;
            padding: 1.5rem;
            font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
            font-size: 14px;
            line-height: 1.6;
        }
        
        .annotation-title {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        
        .category-badge {
            background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
            color: white;
            padding: 0.25rem 0.75rem;
            border-radius: 9999px;
            font-size: 0.75rem;
            font-weight: 500;
        }
        
        .mermaid {
            display: flex;
            justify-content: center;
            margin: 2rem 0;
        }
        
        .floating-icon {
            animation: float 3s ease-in-out infinite;
        }
        
        @keyframes float {
            0%, 100% { transform: translateY(0px); }
            50% { transform: translateY(-10px); }
        }
        
        .drop-cap {
            float: left;
            font-size: 4rem;
            line-height: 1;
            font-weight: 700;
            margin-right: 0.5rem;
            margin-top: -0.25rem;
            color: #667eea;
            font-family: 'Noto Serif SC', serif;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-6">
        <div class="max-w-6xl mx-auto text-center">
            <div class="floating-icon inline-block mb-6">
                <i class="fas fa-code text-6xl opacity-80"></i>
            </div>
            <h1 class="text-5xl md:text-6xl font-bold mb-6 tracking-tight">
                Spring 注解完全指南
            </h1>
            <p class="text-xl md:text-2xl opacity-90 max-w-3xl mx-auto leading-relaxed">
                掌握 Spring 框架的核心注解，构建优雅高效的企业级应用
            </p>
            <div class="mt-10 flex justify-center space-x-4">
                <span class="category-badge"><i class="fas fa-tag mr-1"></i> 28个核心注解</span>
                <span class="category-badge"><i class="fas fa-book mr-1"></i> 完整示例代码</span>
                <span class="category-badge"><i class="fas fa-chart-line mr-1"></i> 最佳实践</span>
            </div>
        </div>
    </section>

    <!-- Introduction Section -->
    <section class="py-16 px-6">
        <div class="max-w-4xl mx-auto">
            <div class="annotation-card rounded-2xl p-10 shadow-xl">
                <p class="text-lg leading-relaxed text-gray-700">
                    <span class="drop-cap">S</span>pring 框架通过注解极大地简化了 Java 企业级应用的开发。本指南涵盖了 Spring 生态系统中最重要的 28 个注解，从依赖注入到事务管理，从 Web 开发到缓存优化，每个注解都配有详细的说明和实用的代码示例。无论您是 Spring 新手还是经验丰富的开发者，这份指南都将帮助您更深入地理解和运用这些强大的工具。
                </p>
            </div>
        </div>
    </section>

    <!-- Annotation Categories Visualization -->
    <section class="py-16 px-6 bg-gray-50">
        <div class="max-w-6xl mx-auto">
            <h2 class="text-3xl font-bold text-center mb-12 text-gray-800">注解分类概览</h2>
            <div class="mermaid">
                graph TD
                    A[Spring 注解体系] --> B[依赖注入]
                    A --> C[组件扫描]
                    A --> D[Web MVC]
                    A --> E[事务管理]
                    A --> F[配置管理]
                    A --> G[高级特性]
                    
                    B --> B1[@Autowired]
                    B --> B2[@Qualifier]
                    B --> B3[@Value]
                    
                    C --> C1[@Component]
                    C --> C2[@Service]
                    C --> C3[@Repository]
                    C --> C4[@Controller]
                    
                    D --> D1[@RequestMapping]
                    D --> D2[@PathVariable]
                    D --> D3[@RequestBody]
                    D --> D4[@ResponseBody]
                    
                    E --> E1[@Transactional]
                    E --> E2[@EnableTransactionManagement]
                    
                    F --> F1[@Configuration]
                    F --> F2[@Profile]
                    F --> F3[@ConfigurationProperties]
                    
                    G --> G1[@Async]
                    G --> G2[@Cacheable]
                    G --> G3[@Scheduled]
                    G --> G4[@EventListener]
                    
                    style A fill:#667eea,stroke:#fff,stroke-width:3px,color:#fff
                    style B fill:#f093fb,stroke:#fff,stroke-width:2px,color:#fff
                    style C fill:#f093fb,stroke:#fff,stroke-width:2px,color:#fff
                    style D fill:#f093fb,stroke:#fff,stroke-width:2px,color:#fff
                    style E fill:#f093fb,stroke:#fff,stroke-width:2px,color:#fff
                    style F fill:#f093fb,stroke:#fff,stroke-width:2px,color:#fff
                    style G fill:#f093fb,stroke:#fff,stroke-width:2px,color:#fff
            </div>
        </div>
    </section>

    <!-- Annotations List -->
    <section class="py-16 px-6">
        <div class="max-w-6xl mx-auto">
            <div class="grid gap-8">
                
                <!-- @Autowired -->
                <div class="annotation-card rounded-xl p-8 shadow-lg">
                    <div class="flex items-start justify-between mb-4">
                        <h3 class="text-2xl font-bold annotation-title">1. @Autowired</h3>
                        <span class="text-sm text-gray-500 bg-gray-100 px-3 py-1 rounded-full">
                            <i class="fas fa-plug mr-1"></i> 依赖注入
                        </span>
                    </div>
                    <p class="text-gray-700 mb-6 leading-relaxed">
                        自动装配依赖项。使用在构造函数、属性或方法上，Spring 会自动解析并注入对应的依赖项。
                    </p>
                    <div class="code-block">
                        <pre><code>// Autowiring through constructor
@Autowired
public ExampleClass(Dependency dependency) {
    this.dependency = dependency;
}

// Autowiring through field
@Autowired
private Dependency dependency;

// Autowiring through setter method
@Autowired
public void setDependency(Dependency dependency) {
    this.dependency = dependency;
}</code></pre>
                    </div>
                </div>

                <!-- @Component -->
                <div class="annotation-card rounded-xl p-8 shadow-lg">
                    <div class="flex items-start justify-between mb-4">
                        <h3 class="text-2xl font-bold annotation-title">2. @Component</h3>
                        <span class="text-sm text-gray-500 bg-gray-100 px-3 py-1 rounded-full">
                            <i class="fas fa-cube mr-1"></i> 组件扫描
                        </span>
                    </div>
                    <p class="text-gray-700 mb-6 leading-relaxed">
                        将一个类标识为 Spring 管理的组件。通常与自动装配配合使用。
                    </p>
                    <div class="code-block">
                        <pre><code>@Component
public class ExampleComponent {
    // Class definition
}</code></pre>
                    </div>
                </div>

                <!-- @Controller -->
                <div class="annotation-card rounded-xl p-8 shadow-lg">
                    <div class="flex items-start justify-between mb-4">
                        <h3 class="text-2xl font-bold annotation-title">3. @Controller</h3>
                        <span class="text-sm text-gray-500 bg-gray-100 px-3 py-1 rounded-full">
                            <i class="fas fa-globe mr-1"></i> Web MVC
                        </span>
                    </div>
                    <p class="text-gray-700 mb-6 leading-relaxed">
                        标识一个类为 Spring MVC 的控制器组件。用于处理用户请求并返回响应。
                    </p>
                    <div class="code-block">
                        <pre><code>@Controller
public class ExampleController {
    @RequestMapping("/example")
    public String handleRequest() {
        // Handle request and return a view
        return "view";
    }
}</code></pre>
                    </div>
                </div>

                <!-- @Service -->
                <div class="annotation-card rounded-xl p-8 shadow-lg">
                    <div class="flex items-start justify-between mb-4">
                        <h3 class="text-2xl font-bold annotation-title">4. @Service</h3>
                        <span class="text-sm text-gray-500 bg-gray-100 px-3 py-1 rounded-full">
                            <i class="fas fa-cogs mr-1"></i> 组件扫描
                        </span>
                    </div>
                    <p class="text-gray-700 mb-6 leading-relaxed">
                        标识一个类为服务组件，通常在业务逻辑层使用。
                    </p>
                    <div class="code-block">
                        <pre><code>@Service
public class ExampleService {
    // Class definition
}</code></pre>
                    </div>
                </div>

                <!-- @Repository -->
                <div class="annotation-card rounded-xl p-8 shadow-lg">
                    <div class="flex items-start justify-between mb-4">
                        <h3 class="text-2xl font-bold annotation-title">5. @Repository</h3>
                        <span class="text-sm text-gray-500 bg-gray-100 px-3 py-1 rounded-full">
                            <i class="fas fa-database mr-1"></i> 组件扫描
                        </span>
                    </div>
                    <p class="text-gray-700 mb-6 leading-relaxed">
                        标识一个类为数据访问组件，通常在数据访问层使用。
                    </p>
                    <div class="code-block">
                        <pre><code>@Repository
public class ExampleRepository {
    // Class definition
}</code></pre>
                    </div>
                </div>

                <!-- @Configuration -->
                <div class="annotation-card rounded-xl p-8 shadow-lg">
                    <div class="flex items-start justify-between mb-4">
                        <h3 class="text-2xl font-bold annotation-title">6. @Configuration</h3>
                        <span class="text-sm text-gray-500 bg-gray-100 px-3 py-1 rounded-full">
                            <i class="fas fa-sliders-h mr-1"></i> 配置管理
                        </span>
                    </div>
                    <p class="text-gray-700 mb-6 leading-relaxed">
                        标识一个类为配置类，用于声明 Bean 的创建和其他配置。
                    </p>
                    <div class="code-block">
                        <pre><code>@Configuration
public class AppConfig {
    // Bean configurations
    @Bean
    public ExampleBean exampleBean() {
        return new ExampleBean();
    }
}</code></pre>
                    </div>
                </div>

                <!-- @RequestMapping -->
                <div class="annotation-card rounded-xl p-8 shadow-lg">
                    <div class="flex items-start justify-between mb-4">
                        <h3 class="text-2xl font-bold annotation-title">7. @RequestMapping</h3>
                        <span class="text-sm text-gray-500 bg-gray-100 px-3 py-1 rounded-full">
                            <i class="fas fa-route mr-1"></i> Web MVC
                        </span>
                    </div>
                    <p class="text-gray-700 mb-6 leading-relaxed">